package com.ugoodtech.mdcc.core.model.mapper;

import com.ugoodtech.mdcc.core.model.entity.QuestionAnswerOptions;
import com.ugoodtech.mdcc.core.model.entity.QuestionAnswerOptionsExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface QuestionAnswerOptionsMapper {
    @SelectProvider(type=QuestionAnswerOptionsSqlProvider.class, method="countByExample")
    int countByExample(QuestionAnswerOptionsExample example);

    @DeleteProvider(type=QuestionAnswerOptionsSqlProvider.class, method="deleteByExample")
    int deleteByExample(QuestionAnswerOptionsExample example);

    @Delete({
        "delete from question_answer_options",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into question_answer_options (id, creation_time, ",
        "deleted, enabled, update_time, ",
        "description, extra, ",
        "idx, name, value, ",
        "question_id, addText, ",
        "advice, evaluation, ",
        "owner)",
        "values (#{id,jdbcType=BIGINT}, #{creationTime,jdbcType=TIMESTAMP}, ",
        "#{deleted,jdbcType=BIT}, #{enabled,jdbcType=BIT}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{description,jdbcType=VARCHAR}, #{extra,jdbcType=VARCHAR}, ",
        "#{idx,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, ",
        "#{questionId,jdbcType=BIGINT}, #{addtext,jdbcType=BIT}, ",
        "#{advice,jdbcType=VARCHAR}, #{evaluation,jdbcType=VARCHAR}, ",
        "#{owner,jdbcType=INTEGER})"
    })
    int insert(QuestionAnswerOptions record);

    @InsertProvider(type=QuestionAnswerOptionsSqlProvider.class, method="insertSelective")
    int insertSelective(QuestionAnswerOptions record);

    @SelectProvider(type=QuestionAnswerOptionsSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="creation_time", property="creationTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="deleted", property="deleted", jdbcType=JdbcType.BIT),
        @Result(column="enabled", property="enabled", jdbcType=JdbcType.BIT),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="extra", property="extra", jdbcType=JdbcType.VARCHAR),
        @Result(column="idx", property="idx", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="value", property="value", jdbcType=JdbcType.VARCHAR),
        @Result(column="question_id", property="questionId", jdbcType=JdbcType.BIGINT),
        @Result(column="addText", property="addtext", jdbcType=JdbcType.BIT),
        @Result(column="advice", property="advice", jdbcType=JdbcType.VARCHAR),
        @Result(column="evaluation", property="evaluation", jdbcType=JdbcType.VARCHAR),
        @Result(column="owner", property="owner", jdbcType=JdbcType.INTEGER)
    })
    List<QuestionAnswerOptions> selectByExample(QuestionAnswerOptionsExample example);

    @Select({
        "select",
        "id, creation_time, deleted, enabled, update_time, description, extra, idx, name, ",
        "value, question_id, addText, advice, evaluation, owner",
        "from question_answer_options",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="creation_time", property="creationTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="deleted", property="deleted", jdbcType=JdbcType.BIT),
        @Result(column="enabled", property="enabled", jdbcType=JdbcType.BIT),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="extra", property="extra", jdbcType=JdbcType.VARCHAR),
        @Result(column="idx", property="idx", jdbcType=JdbcType.INTEGER),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="value", property="value", jdbcType=JdbcType.VARCHAR),
        @Result(column="question_id", property="questionId", jdbcType=JdbcType.BIGINT),
        @Result(column="addText", property="addtext", jdbcType=JdbcType.BIT),
        @Result(column="advice", property="advice", jdbcType=JdbcType.VARCHAR),
        @Result(column="evaluation", property="evaluation", jdbcType=JdbcType.VARCHAR),
        @Result(column="owner", property="owner", jdbcType=JdbcType.INTEGER)
    })
    QuestionAnswerOptions selectByPrimaryKey(Long id);

    @UpdateProvider(type=QuestionAnswerOptionsSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") QuestionAnswerOptions record, @Param("example") QuestionAnswerOptionsExample example);

    @UpdateProvider(type=QuestionAnswerOptionsSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") QuestionAnswerOptions record, @Param("example") QuestionAnswerOptionsExample example);

    @UpdateProvider(type=QuestionAnswerOptionsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(QuestionAnswerOptions record);

    @Update({
        "update question_answer_options",
        "set creation_time = #{creationTime,jdbcType=TIMESTAMP},",
          "deleted = #{deleted,jdbcType=BIT},",
          "enabled = #{enabled,jdbcType=BIT},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "description = #{description,jdbcType=VARCHAR},",
          "extra = #{extra,jdbcType=VARCHAR},",
          "idx = #{idx,jdbcType=INTEGER},",
          "name = #{name,jdbcType=VARCHAR},",
          "value = #{value,jdbcType=VARCHAR},",
          "question_id = #{questionId,jdbcType=BIGINT},",
          "addText = #{addtext,jdbcType=BIT},",
          "advice = #{advice,jdbcType=VARCHAR},",
          "evaluation = #{evaluation,jdbcType=VARCHAR},",
          "owner = #{owner,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(QuestionAnswerOptions record);
}